package GUI;

import javax.swing.JPanel;
import java.awt.Color;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import java.awt.Font;
import javax.swing.JTextField;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class UpdatePassword extends JPanel {

	private static final long serialVersionUID = 1L;
	private JTextField uName;
	private JTextField pass;
	private JTextField verPass;
	private JButton btnBack;
	private JButton btnChange1;
	private JLabel iconlabel;


	//constructor
	public UpdatePassword() {
		setBackground(new Color(255, 69, 0));
		setLayout(null);
		btnBack = new JButton("Back");
		
		btnBack.setIcon(new ImageIcon(UpdatePassword.class.getResource("/resources/back22.png")));
		uName = new JTextField();
		uName.addKeyListener(new KeyAdapter() {
			public void keyTyped(KeyEvent evt) {
				char c = evt.getKeyChar();
				if(!(Character.isDigit(c) || (c==KeyEvent.VK_BACK_SPACE) || (c==KeyEvent.VK_DELETE))){
					getToolkit().beep();
					evt.consume();
				}
			}
		});
		
		uName.setFont(new Font("Tahoma", Font.BOLD, 12));
		btnChange1 = new JButton("Change");
		btnChange1.setIcon(new ImageIcon(UpdatePassword.class.getResource("/resources/change.png")));
		pass = new JTextField();
		pass.setFont(new Font("Tahoma", Font.BOLD, 12));
		verPass = new JTextField();
		verPass.setFont(new Font("Tahoma", Font.BOLD, 12));
		initialize();
		
	}//end constructor
	
	public void initialize(){
		JLabel lblNewLabel = new JLabel("Update Password");
		lblNewLabel.setForeground(new Color(0, 204, 255));
		lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 16));
		lblNewLabel.setBounds(10, 24, 202, 33);
		add(lblNewLabel);
		
	
		btnBack.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnBack.setBounds(10, 462, 101, 27);
		add(btnBack);
		
		JLabel lblEnterNewUser = new JLabel("Enter user name:");
		lblEnterNewUser.setForeground(Color.WHITE);
		lblEnterNewUser.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblEnterNewUser.setBounds(199, 137, 182, 24);
		add(lblEnterNewUser);
		
		JLabel lblEnterNewPassword = new JLabel("Enter new password:");
		lblEnterNewPassword.setForeground(Color.WHITE);
		lblEnterNewPassword.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblEnterNewPassword.setBounds(199, 212, 182, 24);
		add(lblEnterNewPassword);
		
		
		uName.setBounds(391, 137, 123, 27);
		add(uName);
		uName.setColumns(10);
		
		btnChange1.setFont(new Font("Tahoma", Font.BOLD | Font.ITALIC, 12));
		btnChange1.setBounds(391, 369, 123, 27);
		add(btnChange1);
		
		
		pass.setColumns(10);
		pass.setBounds(391, 212, 123, 27);
		add(pass);
		
		JLabel lblEnterNewPassword_1 = new JLabel("Enter new password again:");
		lblEnterNewPassword_1.setForeground(Color.WHITE);
		lblEnterNewPassword_1.setFont(new Font("Tahoma", Font.BOLD, 12));
		lblEnterNewPassword_1.setBounds(199, 287, 182, 24);
		add(lblEnterNewPassword_1);
	
		verPass.setColumns(10);
		verPass.setBounds(391, 287, 123, 27);
		add(verPass);
		
		ImageIcon LOGOImageIcon = new ImageIcon(getClass().getClassLoader().getResource("resources/camera-background3.png"));
		ImageIcon LOGO = new ImageIcon (LOGOImageIcon.getImage().getScaledInstance(-1, -1, java.awt.Image.SCALE_SMOOTH));
		
		iconlabel = new JLabel("");
		iconlabel.setIcon(LOGO);
		iconlabel.setBounds(0, 0, 786, 500);
		add(iconlabel);
	}
	/**
	 * @return the btnBack
	 */
	public JButton getBtnBack() {
		return btnBack;
	}



	/**
	 * @return the btnChange
	 */
	public JButton getBtnChange() {
		return btnChange1;
	}

	
	/**
	 * @return the verPass
	 */
	public JTextField getVerPass() {
		return verPass;
	}



	/**
	 * @return the uName
	 */
	public JTextField getuName() {
		return uName;
	}



	/**
	 * @return the pass
	 */
	public JTextField getPass() {
		return pass;
	}


}
